package com.zixuan.yuojbackendjudgeservice.judge.codesandbox;


import com.zixuan.yuojbackendjudgeservice.judge.codesandbox.impl.ExampleCodeSandBox;
import com.zixuan.yuojbackendjudgeservice.judge.codesandbox.impl.RemoteCodeSandBox;
import com.zixuan.yuojbackendjudgeservice.judge.codesandbox.impl.ThirdCodeSandBox;

/**
 * @author Mr.Mei
 * @date 2023/11/14
 *
 * 工厂模式，根据传入的type创建不同的实例
 */
public class CodeSandBoxFactory {

    public static CodeSandBox newInstance(String type) {
        switch (type) {
            case "example": return new ExampleCodeSandBox();
            case "remote": return new RemoteCodeSandBox();
            case "third": return new ThirdCodeSandBox();
            default: return  new ExampleCodeSandBox();
        }
    }
}
